// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name:   CMPP30SubmitRepMessage.java

package com.haoxi.gateway.test.message;

import com.haoxi.gateway.test.CMPPConstant;
import com.haoxi.gateway.test.util.TypeConvert;

public class CMPP30SubmitRepMessage extends CMPPMessage {

    public CMPP30SubmitRepMessage(int SequenceID, int result) {
        int len = 24;
        buf = new byte[len];
        TypeConvert.int2byte(len, buf, 0);
        TypeConvert.int2byte(0x80000004, buf, 4);
        this.setSequenceId(SequenceID);
        byte[] msgID = getMsgID1();
        System.arraycopy(msgID, 0, buf, 12, 8);
        TypeConvert.int2byte(result, buf, 20);
    }

    public CMPP30SubmitRepMessage(byte buf[]) throws IllegalArgumentException {
        super.buf = new byte[16];
        if (buf.length != 16) {
            throw new IllegalArgumentException(CMPPConstant.SMC_MESSAGE_ERROR);
        } else {
            System.arraycopy(buf, 0, super.buf, 0, 16);
            sequence_Id = TypeConvert.byte2int(super.buf, 0);
            return;
        }
    }

    public String getMsgIDStr() {
        byte tmpMsgId[] = new byte[8];
        System.arraycopy(buf, 12, tmpMsgId, 0, 8);
        StringBuffer buffer = new StringBuffer();
        for (int i = 0; i < tmpMsgId.length; i++) {
            buffer.append(tmpMsgId[i]);
        }
        return buffer.toString();
    }

    public byte[] getMsgId() {
        byte tmpMsgId[] = new byte[8];
        System.arraycopy(buf, 12, tmpMsgId, 0, 8);
        return tmpMsgId;
    }

    public int getResult() {
        return TypeConvert.byte2int(buf, 20);
    }

    public int getMsgLength() {
        message_Length = TypeConvert.byte2int(super.buf, 0);
        return message_Length;
    }

    public String toString() {
        String tmpStr = "CMPP_Submit_REP: ";
        tmpStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(tmpStr)))).append("\r\nMsgLength=")
                .append(getMsgLength())));
        tmpStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(tmpStr)))).append("\r\nSequence_Id=")
                .append(getSequenceId())));
        tmpStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(tmpStr)))).append("\r\nMsgIdStr=")
                .append(getMsgIDStr())));
        tmpStr = String.valueOf(String.valueOf((new StringBuffer(String
                .valueOf(String.valueOf(tmpStr)))).append("\r\nResult=")
                .append(getResult())));
        return tmpStr;
    }

    public int getCommandId() {
        return 0x80000004;
    }
}
